Hi experts, i want to export all my users mailboxes statistics to csv file, their mailbox usage, mailbox quota, i have exchange online and exchange on premises, while pulling the report i want the mailbox type to be mentioned as office 365(though i will be pulling it for O365)but required for certain other purposes, and is auditing enabled for the mailbox or not

2 Spice ups

Hi

I do similar but only for our in-house Exchange box as we have not yet made the move to Office365. Could you use ( Get-MailboxStatistics (ExchangePowerShell) | Microsoft Learn )

I run and then output into a CSV outputting the user/size/quota etc. Check here https://www.petri.com/getting-mailbox-sizes-in-powershell

can you plz help me with ur syntax

I tried the below script but i am getting error

mailboxstats.ps1 | Export-Csv “C:\MailboxStatics.csv” -notypeinformation

foreach($users in Get-Mailbox -ResultSize Unlimited){$users | Foreach-Object {
$user = $_
$stats = Get-MailboxStatistics $user.Name
New-Object -TypeName PSObject -Property @{
DisplayName = $User.DisplayName
IssueWarningQuota = $User.IssueWarningQuota
ProhibitSendQuota = $User.ProhibitSendQuota
ProhibitSendReceiveQuota = $User.ProhibitSendReceiveQuota
TotalItemSize = $stats.TotalItemSize
AuditEnabled = $User.AuditEnabled
}
}
}

i am getting below errors

PS] C:>.\mailboxstats.ps1 | Export-Csv “C:\MailboxStatics.csv” -notypeinformation
At C:\mailboxstats.ps1:6 char:27

  • IssueWarningQuota = $User.?IssueWarningQuota
  • ~
    Missing property name after reference operator.
    At C:\mailboxstats.ps1:7 char:27
  • ProhibitSendQuota = $User.?ProhibitSendQuota
  • ~
    Missing property name after reference operator.
    At C:\mailboxstats.ps1:8 char:34
  • ProhibitSendReceiveQuota = $User.?ProhibitSendReceiveQuota
  • ~
    Missing property name after reference operator.
  • CategoryInfo : ParserError: (:slight_smile: , ParseException
  • FullyQualifiedErrorId : MissingPropertyName